package j3dscene;

import javax.media.j3d.BoundingSphere;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.DirectionalLight;
import javax.vecmath.Color3f;
import javax.vecmath.Point3d;
import javax.vecmath.Vector3f;

/**
 * BranchGroup which stores the light
 *
 * @author Dominik K.
 * @author Steffen G.
 */
public class Light extends BranchGroup {

  /**
   *  adds three point illumination
   */
    public Light() {
        BoundingSphere bounds1 = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 4);
        BoundingSphere bounds2 = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 4);
        BoundingSphere bounds3 = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100);

        /* light 1 */
        Color3f lightColour1 = new Color3f(1.0f, 1.0f, 1.0f);
        Vector3f lightDir1 = new Vector3f(0.56f, -0.2f, 0.5f);
        DirectionalLight light1 = new DirectionalLight(lightColour1, lightDir1);
        light1.setInfluencingBounds(bounds1);

        /* light 2 */
        Color3f lightColour2 = new Color3f(1.0f, 1.0f, 1.0f);
        Vector3f lightDir2 = new Vector3f(-0.56f, -0.2f, 0.5f);
        DirectionalLight light2 = new DirectionalLight(lightColour2, lightDir2);
        light2.setInfluencingBounds(bounds2);

        /* light 3 */
        Color3f lightColour3 = new Color3f(0.6f, 0.6f, 0.6f);
        Vector3f lightDir3 = new Vector3f(0.0f, -0.6f, -2.0f);
        DirectionalLight light3 = new DirectionalLight(lightColour3, lightDir3);
        light3.setInfluencingBounds(bounds3);


        addChild(light1);
        addChild(light2);
        addChild(light3);

    }
}
